class EnvHelper {
    public env = {} as ImportMetaEnv;

    constructor() {
        this.env = this.getEnv();
    }

    getEnv(): ImportMetaEnv {
        const envs = {} as ImportMetaEnv;
        Object.entries(import.meta.env).forEach(([key, value]) => {
            if (['true', 'false'].includes(value)) envs[key] = value === 'true';
            else if (/^\d+$/.test(value)) envs[key] = Number(value);
            else if (value == 'null') envs[key] = null;
            else if (value == 'undefined') envs[key] = undefined;
            else envs[key] = value;
        })

        return envs;
    }
}

const myEnv = new EnvHelper().env;

export default myEnv